<template>
    <el-form :model="queryParams" ref="queryRef" v-show="showSearch" :inline="true" label-width="68px">
        <el-form-item label="申请科室" prop="applyDept">
            <el-input
                v-model="queryParams.applyDept"
                placeholder="请输入申请科室"
                clearable
                style="width: 240px"
                />
            </el-form-item>
            <el-form-item label="资产编码" prop="deviceNO">
                <el-input
                v-model="queryParams.deviceNO"
                placeholder="请输入资产编码"
                clearable
                style="width: 240px"
                />
            </el-form-item>
            <el-form-item label="设备名称" prop="deviceName">
            <el-input
                    v-model="queryParams.deviceName"
                    placeholder="请输入设备名称"
                    clearable
                    style="width: 240px"
                />
            </el-form-item>
            <el-form-item label="紧急程度" prop="urgency">
                <el-select
                v-model="queryParams.urgency"
                placeholder="紧急程度"
                clearable
                style="width: 240px"
                >
                <el-option
                    v-for="dict in device_update_urgency"
                    :key="dict.value"
                    :label="dict.label"
                    :value="dict.value"
                />
                </el-select>
            </el-form-item>
            <el-form-item label="院区" prop="hospital">
                <el-input
                v-model="queryParams.hospital"
                placeholder="请输入院区"
                clearable
                style="width: 240px"
                />
            </el-form-item>
            <el-form-item>
                <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
                <el-button icon="Refresh" @click="resetQuery">重置</el-button>
            </el-form-item>
    </el-form>
    <el-button type="primary" plain icon="Plus" @click="handleAdd">添加更新设备</el-button> 
    <el-button type="warning" icon="Download" @click="handleExport">导出</el-button> 
    <el-table v-loading="loading" :data="deviceUpdateList" @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55" align="center" />
         <el-table-column label="申请科室" prop="applyDept" width="120" />
         <el-table-column label="主机设备固定资产编码" prop="deviceNO" :show-overflow-tooltip="true" width="150" />
         <el-table-column label="其他配件固定资产编码" prop="scrapPartsDeviceNos" :show-overflow-tooltip="true" width="150" />
         <el-table-column label="设备名称" prop="deviceName" width="100" />
         <el-table-column label="设备型号" prop="model" align="center" width="100">
         </el-table-column>
         <el-table-column label="生产厂家" align="center" prop="brand">
         </el-table-column>
         <el-table-column label="购置/启用时间" prop="useStartDate" width="100" />
         <el-table-column label="紧急程度" prop="urgency" width="100" />
         <el-table-column label="单价金额(元)" prop="unitPrice" width="100" />
         <el-table-column label="总价金额(元)" prop="totalPrice" width="100" />
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
            <template #default="scope">
               <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">编辑</el-button>
               <el-button link type="primary" icon="Delete" @click="handleDekete(scope.row)">删除</el-button>
            </template>
         </el-table-column>
      </el-table>

      <pagination
         v-show="total > 0"
         :total="total"
         v-model:page="queryParams.pageNo"
         v-model:limit="queryParams.pageSize"
         @pagination="getList"
      />
      <add-device ref="addDeviceRef"></add-device>
</template>
<script setup name="deviceUpdate">

import addDevice from "./addDevice"

const { proxy } = getCurrentInstance()
const { device_update_urgency } = proxy.useDict("device_update_urgency")

const deviceUpdateList = ref([])
const showSearch = ref(true)
const loading = ref(false)
const total = ref(0)

const data = reactive({
  queryParams: {
    pageNo: 1,
    pageSize: 10
  },
   rules: {}
})
const { queryParams} = toRefs(data)
function handleQuery(){}
function resetQuery(){}

function handleAdd(){
  proxy.$refs["addDeviceRef"].show()
}
function getList(){}
function handleUpdate(){}
function handleDekete(){}
function handleExport(){}
function handleSelectionChange(){}


</script>